// import from "../../apis/mine.js"
import apis from "../../http/apis"
export default {
	namespaced: true,
	state: {
		//初始列表数据
		brandInfo:[],
		carListInfo:[],
		carSeriesInfo:[],
		lovaCarAll:[]
	},
	mutations: {
		setCarBrand(state, data) {
			state.brandInfo = data
		},
		setCarList(state,data){
			state.carListInfo=data
		},
		setCarSeries(state,data){
			state.carSeriesInfo=data
		},
		setLoveCarAll(state,data){
			state.lovaCarAll=data
		}
	},
	actions: {
		//context
		async getCarBrandAll(context){
			let data =await apis.getCarBrand()
			context.commit('setCarBrand',data.data)
			// console.log(data)
		},
		async getCarListAll(context,params){
			let data =await apis.getCarList(JSON.stringify(params))
			context.commit('setCarList',data.data)
			return data.data
		},
		async getCarSeriesAll(context,params){
			console.log(params)
			let data =await apis.getCarSeries(params)
			console.log('setCarSeries',data)
			context.commit('setCarSeries',data.data)
			return data.data
		},
		async addLoveCarOne(context,params){
			let data =await apis.addMyLoveCar(params)
			return data
		},
		//获取所有的爱车信息
		async getMyLoveCarAll(context){
			let data =await apis.getMyLoveCar();
			context.commit('setLoveCarAll',data.data)
			console.log(data)
		},
		//删除我的某一爱车
		async delMyLoveCar(context,params){
			let data =await apis.delMyLoveCarOne(params);
			return data
		}
	},
}
